============================================================== Guild: wafer.space Community Channel: 📐 - Designing / 🕰️-analog / Magic is confusing to me, like, _very._ After: 2026-08-31 11:59 p.m. Before: 2026-10-01 12:00 a.m. ============================================================== [2026-09-29 12:56 a.m.] bailey8889 [2026-09-29 12:56 a.m.] bailey8889 Definitely aware of the confusion around magic. It's based on many different paradigms. So are you using kpex or some other flow? Are you required to flatten the layout in klayout before running the extraction? [2026-09-29 12:56 a.m.] namibj No, see the script above [2026-09-29 12:57 a.m.] namibj I notably don't want to wait further HOURS for magic to extract at multiple hierarchy levels [2026-09-29 1:31 a.m.] bailey8889 Ok, the `extract_spice_simplified.py` file, right? I think these commands will yield a flattened parasitic extracted netlist with a hierarchical layout as input. It also turns off some of the backup processing that may speed things up. The `short resistor` directives adds a 0Ω resistor between shorted ports instead of dropping them. And the `feedback save` will save any extraction anomalies (text problems, etc.). ``` magic_commands = [ "drc off", "gds drccheck off", "undo disable", "locking disable", "crashbackups stop", f"gds read {tcl_brace(temp_gds)}", f"load {tcl_brace(top_cell)}", "select top cell", "port makeall", "expand", f"flatten {tcl_brace(top_cell)}_flat", f"load {tcl_brace(top_cell)}_flat", f"cellname delete {tcl_brace(top_cell)}", f"cellname rename {tcl_brace(top_cell)}_flat {tcl_brace(top_cell)}", "select top cell", "ext2spice lvs", "ext2spice rthresh 0", "ext2spice merge conservative" "ext2spice short resistor" "extresist simplify on", "extresist minres 100", "extresist threshold 1000", "extract do resistance", "extract all", "ext2spice extresist on", "ext2spice resistor tee on", "feedback save {tcl_brace(top_cell)}.pex.feedback.txt", ] ``` Haven't tested, just added some of the commands from my scripts and Tim's comments. [2026-09-29 2:32 a.m.] namibj hmmmm will try later, it's a hot day I need to get to sleep sooner than later {Reactions} 👍 [2026-09-30 1:36 a.m.] namibj OK, so, what I would enjoy is hierachical LVS but global/flattened PEX. Yes, including as needed 0-ohm's to maintain appropriate local naming of nets. And eliding those 0-ohm's where that'll not create conflicts, i.e., just propagating such a name beyond to what would have been auto-named instead. [2026-09-30 7:18 a.m.] bailey8889 Oh, are you using the same script for LVS extraction and PEX extraction? Maybe you want to divide those, or at least use different magic scripts. BTW, I think the flattening above does NOT propagate lower hierarchy text to the top, so there's no problem with local naming of nets (if I understand your comment). These are the commands that I use for hierarchical extraction for LVS. ``` drc off crashbackups stop gds drccheck off undo disable locking disable gds flatten yes # flattens cells with less than 10 shapes gds flatglob # repeated for other larger cells to be flattened before extracting. Note: All subcells must be explicitly flattened too. gds read load select top cell expand extract no all ;# clear all flags extract do aliases extract do local extract unique ext2spice lvs ext2spice merge conservative ;# reduce parallel devices ext2spice short resistor ;# keep both ports but connect them with a 0 ohm resistor ext2spice -o .gds.spice .ext feedback save .feedback.txt ``` Fun fact: magic's default extraction connects virtual nets by name - disjoint nets with the same label are extracted as connected. Use `extract unique` to automatically add a `_uq*` suffix to unconnected duplicate labels. [2026-09-30 7:52 a.m.] namibj Oh I'm not doing LVS with this; this is for extraction of largs hard macros and entire dies into Xyce. [2026-09-30 7:54 a.m.] namibj I.... did some stuff in KLayout macro/scripting to lift labels up to top level shapes while attaching path prefixes reflecting instance IDs..... [2026-09-30 7:57 a.m.] namibj I wonder if I maybe should do something to reduce shapes after the flattening on the KLayout side and before feeding it to magic? [2026-09-30 8:11 a.m.] bailey8889 Still not understanding the need to flatten in Klayout (unless you need those internal net names). Came across this command in magic that fractures layers into simple polygons. For example ``` M1 = input(13, 0) M1.data = M1.data.merged(true, 0).decompose_convex_to_region M1.output(13, 0) ``` [2026-09-30 8:24 a.m.] namibj those net names were requested by Tholin. {Reactions} 👍 [2026-09-30 8:24 a.m.] namibj (for debugging purposes) [2026-09-30 8:28 a.m.] namibj I'd wish the PEX would manage to pick a fragment of RC-fractured net actually covered by the drawn label if it's an area label or where a mere point label happens to hit, when extracting; as I don't particularly care for the nuanced names of intermediate chunks of the RC lumped transmission/delay line "model" that'll extract, but we'll have to see I guess..... [2026-09-30 8:28 a.m.] namibj not like LVS connectivity rules actually apply at PEX time 🙁 ============================================================== Exported 16 message(s) ==============================================================